﻿using System;
using Orchard.Events;
using Orchard.Localization;
using Orchard.Environment.Extensions;

namespace Rework.CommerceHistory.Rules {
    [OrchardFeature("Rework.CommercePayPal")]
    public class CommercePayPalEvents : IEventProvider {
        public CommercePayPalEvents() {
            T = NullLocalizer.Instance;
        }

        public Localizer T { get; set; }

        public void Describe(dynamic describe) {
            Func<dynamic, bool> alwaysTrue = c => true;

            describe.For("CommercePayPal", T("Commerce PayPal"), T("Commerce PayPal"))
                .Element("ErrorMessage", T("New PayPal error message"), T("An issue has developed during PayPal processing. This message typically should go to site administrator."), alwaysTrue, (Func<dynamic, LocalizedString>)(context => T("When error occurs during PayPal processing.")), null)
                .Element("ProcessingComplete", T("PayPal product processing complete"), T("PayPal has succeeded in processing purchased product."), alwaysTrue, (Func<dynamic, LocalizedString>)(context => T("When product PayPal processing is complete.")), null)
                .Element("ProcessingIncomplete", T("PayPal product processing incomplete"), T("PayPal had an issue processing purchased product."), alwaysTrue, (Func<dynamic, LocalizedString>)(context => T("When product PayPal processing is incomplete.")), null)
                ;
        }
    }
}